<template>
  <div class="hread">
    <div class="logo">
      <img src="../assets/img/logo.png" />
      <i
        class="iconfont"
        @click="TOGGLE_SIDEBAR"
        :class="!sidebar ? 'icon-foldLeft' : 'icon-foldRight'"
      ></i>
    </div>
    <div class="hread-tlt">
      <div class="username">
        {{ username }}({{ type == 1 ? "超级管理员" : "普通管理员" }})
      </div>
      <div class="userimg">
        <img src="../assets/img/gita.gif" />
      </div>
      <div class="off">
        <span @click="LogoutAction">退出登录</span>
      </div>
      <div class="yuyan">
        <img src="../assets/img/cn.png" />
      </div>
    </div>
  </div>
</template>

<script>
// 引入vuex 工具方法
import { mapGetters, mapMutations, mapActions } from "vuex";
export default {
  props: [],
  name: "Myhread",

  methods: {
    ...mapMutations(["TOGGLE_SIDEBAR"]),
    ...mapActions(["LogoutAction"]),
  },
  computed: {
    ...mapGetters(["sidebar", "username", "type"]),
  },
};
</script>

<style scoped lang="scss">
.hread {
  height: 50px;
  background: #fff;
  line-height: 50px;
  display: flex;
  justify-content: space-between;
}
.logo {
  width: 100px;
  height: 40px;
  margin-top: 8px;
  margin-left: 5px;
  display: flex;
  align-items: center;
  i {
    padding-left: 30px;
    cursor: pointer;
  }
  img {
    width: 100%;
  }
}
.hread-tlt {
  display: flex;
  justify-content: space-between;
}
.hread-tlt .username {
  font-size: 13px;
  color: #222;
  padding-right: 10px;
}
.hread-tlt .userimg {
  width: 30px;
  margin-top: 10px;
  padding-right: 10px;
}
.hread-tlt .userimg img {
  width: 30px;
}

.hread-tlt .yuyan img {
  width: 50px;
}
.off span {
  color: #5bacff;
  text-decoration: underline;
  cursor: pointer;
}
</style>